<insert id="insertOrUpdateBatch" parameterType="java.util.List">
    insert into ${table} (
<#list columns as column>
    ${column}<#sep>,
</#list>

    ) values
    <foreach collection="list" item="item" separator=",">
    (
<#list fields as field>
    ${r'#{item.'}${field}${r'}'}<#sep>,
</#list>

    )
    </foreach>
    on duplicate key update
<#list columns as column>
    ${column} = values(${column})<#sep>,
</#list>

</insert>